'''
用例编号：CRM_ST_YX_002
'''
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
from unittest import runner

# 打开浏览器
driver = webdriver.Chrome()
# 访问的网页
driver.get('http://192.168.1.25/crm')
driver.implicitly_wait(30)
# 最大化窗口
driver.maximize_window()

username = '杨应科'
password = '123456'

# 定位器
username_shuru_locator = (By.NAME,'name')
password_shuru_locator = (By.NAME,'password')
dl_dianji_locator = (By.NAME,'submit')
dianji_gd_locator = (By.CSS_SELECTOR,'body > div.navbar.navbar-inverse.navbar-fixed-top > div > div > div.nav-collapse.collapse > ul:nth-child(1) > li.dropdown > a')
dianji_yx_locator = (By.CSS_SELECTOR,'body > div.navbar.navbar-inverse.navbar-fixed-top > div > div > div.nav-collapse.collapse > ul:nth-child(1) > li.dropdown.open > ul > li:nth-child(3) > a')
dianji_yj_locator = (By.CSS_SELECTOR,'body > div.container > div.page-header > ul > li:nth-child(3) > a')

# 执行
driver.find_element(*username_shuru_locator).send_keys(username)
driver.find_element(*password_shuru_locator).send_keys(password)
driver.find_element(*dl_dianji_locator).click()
driver.find_element(*dianji_gd_locator).click()
driver.find_element(*dianji_yx_locator).click()
driver.find_element(*dianji_yj_locator).click()
sleep(5)
driver.quit()